<?php
/**
 * Created by PhpStorm.
 * User: shwy
 * Date: 2017/5/18
 * Time: 15:55
 * 统计报表
 */
class Statisics extends CI_Controller {
    public function __construct()
    {
        parent::__construct();

    }

    public function index()
    {
        $this->load->view('home');
    }

    public function login() {
        $this->load->model('user_model');

        if($this->input->post()) {
            $user_name 	= $this->input->post('username');
            $password 	=$this->input->post('password');

            #region CI自带验证
            $config = array(
                array(
                    'field'=>'username',
                    'label'=>'用户名',
                    'rules'=>'trim|required',
                ),
                array(
                    'field'=>'password',
                    'label'=>'密码',
                    'rules'=>'trim|required',
                )
            );

//            $this->form_validation->set_rules($config);
//            $arg = [
//                'id' => 1,
//            ];
            //查询管理员信息
            $adminInfo =  $this->user_model->get_by_id('*');

            print_r($adminInfo);

//
        }
    }

    public function logout(){
        $this->session->set_userdata('sys_key',null,-1);
        redirect(ADMIN_SITE_URL);
    }

    public function test()
    {
        echo 'user test测试';
    }
}